/*
 * Created by BAC IT Deustche Bank
 * User: Sergio Vasquez
 * Date: 5/12/2009
 * Time: 9:13 AM
 * 
 * Description:
 * 
 */
using System;
using System.Runtime.Serialization;

namespace IScheduler.Core.Exceptions
{
	/// <summary>
	/// Base class for exceptions thrown by the IScheduler core.
	/// </summary>
	[Serializable()]
	public class CoreException : Exception
	{
		/// <summary>
		/// Constructor
		/// </summary>
		public CoreException() : base()
		{
		}
		
		/// <summary>
		/// 
		/// </summary>
		/// <param name="message"></param>
		/// <param name="customName"></param>
		public CoreException(string message, string customName, string defaultexception) : base(defaultexception + message + customName)
		{
			LoggingService.Error(string.Format(defaultexception, customName) + message, this);
		}
		
		/// <summary>
		/// 
		/// </summary>
		/// <param name="message"></param>
		/// <param name="customName"></param>
		/// <param name="innerException"></param>
		public CoreException(string message, string customName, string defaultexception , Exception innerException) : base(defaultexception + message + customName, innerException)
		{
			LoggingService.Error(string.Format(defaultexception, customName) + message, this);
		}
		
		/// <summary>
		/// 
		/// </summary>
		/// <param name="info"></param>
		/// <param name="context"></param>
		protected CoreException(SerializationInfo info, StreamingContext context) : base(info, context)
		{
		}
	}
}
